]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Use ES6 findIndex() method for getting window index
authorverdre <verdre@v0yd.nl>
Mon, 19 Nov 2018 11:28:29 +0000 (12:28 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 31 Jan 2019 17:36:25 +0000 (17:36 +0000)
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/346

js/ui/workspace.js
js/ui/workspaceThumbnail.js

index 31892e56af30bf7fe1c49db12ff5ed3f9dff006a..d8410c2e6e402411493e1733a1780b7717373c61 100644 (file)
@@ -1206,12 +1206,7 @@ var Workspace = class {
     }
 
     _lookupIndex(metaWindow) {
-        for (let i = 0; i < this._windows.length; i++) {
-            if (this._windows[i].metaWindow == metaWindow) {
-                return i;
-            }
-        }
-        return -1;
+        return this._windows.findIndex(w => w.metaWindow == metaWindow);
     }
 
     containsMetaWindow(metaWindow) {
index accac398b3d84f6527bfa5e8c79377cdd5bb9a78..e2417010f3c2242746072bd889a05346a9c9bb0b 100644 (file)
@@ -319,12 +319,7 @@ var WorkspaceThumbnail = class {
     }
 
     _lookupIndex(metaWindow) {
-        for (let i = 0; i < this._windows.length; i++) {
-            if (this._windows[i].metaWindow == metaWindow) {
-                return i;
-            }
-        }
-        return -1;
+        return this._windows.findIndex(w => w.metaWindow == metaWindow);
     }
 
     syncStacking(stackIndices) {